<template>
    <div>
        <span>{{pf}}</span>
<button @click="add">+1{{count}}</button>
<button @click="add11">+11:{{count}}</button>
<button @click="addDelay">actions增加2:{{count}}</button>
    </div>
</template>

<script>
    import {mapGetters} from "vuex"
export default {
        methods: {
            add() {
               this.$store.commit('add');
            },
            add11(){
                this.$store.commit('add',{n:11});
            },
            addDelay(){
                this.$store.dispatch("addDelay",{n:2})
            }
        } ,
        computed: {
            count() {
                return this.$store.state.count
            },
            pf(){
                return this.$store.getters.square
            }
          
        },
    }
</script>
<style scoped>

</style>